/********************************************************************************
 * Copyright (c)2016-2020, ShenZhen WanJiaAn Technology CO.,LTD.
 * All Rights Reserved.
 *
 * File Name     : ProductManager.h
 * Author        : joki.zhu
 * Date          : 2019-10-15
 *
 * Record        :
 * 1.Date        : 2019-10-15
 *   Author      : joki.zhu
 *   Modification: Created file
 ********************************************************************************/

#ifndef __PRODUCTMANAGER_H__
#define __PRODUCTMANAGER_H__


#ifdef __cplusplus
#if __cplusplus
extern "C"{
#endif
#endif /* __cplusplus */

typedef enum {
    PRODUCT_CHIP_HI3518EV300,
    PRODUCT_CHIP_NUM,
}PRODUCT_CHIP_TYPE_E;

typedef enum {
    PRODUCT_SENSOR_PS5260,
    PRODUCT_SENSOR_JXF37,
    PRODUCT_SENSOR_NUM,
}PRODUCT_SENSOR_TYPE_E;

typedef enum {
    PRODUCT_GPIO_PHOTORESISTANCE,       //光敏输入
    PRODUCT_GPIO_IRCUT0,                //IR-CUT控制脚0
    PRODUCT_GPIO_IRCUT1,                //IR-CUT控制脚1
    PRODUCT_GPIO_SPEAK_ENABLE,          //喇叭控制
    PRODUCT_GPIO_LED_BLUE,              //指示灯
    PRODUCT_GPIO_LED_RED,               //指示灯
    PRODUCT_GPIO_KEY_RESET_WIFI_CONFIG,
    PRODUCT_GPIO_INFRAREDLAMP,          //红外灯开关
    PRODUCT_GPIO_WIFI_PWDN,             //wifi模块开关
    PRODUCT_GPIO_WIFI_WAKE,             //wifi模块开关
    PRODUCT_GPIO_KEEP_SELF_POWER,       //保持自身电源控制引脚
    PRODUCT_GPIO_RESET_MCU,             //复位MCU引脚
    PRODUCT_GPIO_LAST,
}PRODUCT_GPIO_TYPE_E;

typedef enum {
    PRODUCT_WIFI_HI1131S,
    PRODUCT_WIFI_HI3861L,
    PRODUCT_WIFI_NUM,
}PRODUCT_WIFI_TYPE_E;

typedef enum {
    PRODUCT_CLIENET_CN,
    PRODUCT_CLIENET_EN, 
    PRODUCT_CLIENET_005,
    PRODUCT_CLIENET_YD,
    PRODUCT_CLIENET_YD_DEV,     //开发环境
    PRODUCT_CLIENET_YD_SLD,     //现网环境
    PRODUCT_CLIENET_YD_JW,     //交维环境
    PRODUCT_CLIENET_YD_DJ,
    PRODUCT_CLIENET_SN,
    PRODUCT_CLIENET_008_EN,
    PRODUCT_CLIENET_008_JP,
    PRODUCT_CLIENET_008_TW,
    PRODUCT_CLIENET_NUM,
}PRODUCT_CLIENET_TYPE_E;

typedef enum {
    PRODUCT_MODEL_B1,
    PRODUCT_MODEL_B5,
    PRODUCT_MODEL_LAST,
}PRODUCT_MODEL_TYPE_E;

typedef struct{
    PRODUCT_MODEL_TYPE_E        ProductModel;
    PRODUCT_CLIENET_TYPE_E      Client;
    PRODUCT_CHIP_TYPE_E         Chip;
    PRODUCT_SENSOR_TYPE_E       Sensor;
    PRODUCT_WIFI_TYPE_E         Wifi;
    char                        HardWareVersion[64];

    int                         SensorImageWidth;
    int                         SensorImageHeigh;

    int                         GpioMap[PRODUCT_GPIO_LAST];
    char                        GpioTriggerLevelMap[PRODUCT_GPIO_LAST];

    char                        bAdcPhotoresistance;
    unsigned int                AdcMaxValue;
    unsigned int                AdcMinValue;

    char                        bLAN;
    char                        b4G;
    char                        bMotor;
    char                        bUVC;
    char                        bInitImageflip;
    char                        bAudio;
    char                        bOsdshow;  
}PRODUCT_HANDLE_S;

int ProductInit(void);
PRODUCT_HANDLE_S *ProductGetHandle();

int ProductGpioConvert(PRODUCT_GPIO_TYPE_E _Gpio);
char ProductGpioTriggerConvert(PRODUCT_GPIO_TYPE_E _Gpio);

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */


#endif /* __PRODUCTMANAGER_H__ */
